package com.tobeface.wechat.message;

import com.tobeface.modules.lang.Requires;

/**
 * @author loudyn
 */
public class WeChatMessageContext {

    private final WeChatMessageChannel channel;
    private final WeChatMessageCredential credential;
    private final WeChatMessage message;

    /**
     * @param channel
     * @param credential
     * @param message
     */
    WeChatMessageContext(WeChatMessageChannel channel, WeChatMessageCredential credential, WeChatMessage message) {
        this.channel = channel;
        this.credential = credential;
        this.message = message;
    }

    public WeChatMessageChannel getChannel() {
        return channel;
    }

    public WeChatMessageCredential getCredential() {
        return credential;
    }

    public WeChatMessage getMessage() {
        return message;
    }


    /**
     *
     * @param channel
     * @param credential
     * @param message
     * @return
     */
    public static WeChatMessageContext of(WeChatMessageChannel channel, WeChatMessageCredential credential,
                                          WeChatMessage message) {

        Requires.notNull(channel, "Channel must not be null!");
        Requires.notNull(credential, "Credentail must not be null!");
        Requires.notNull(message, "Message must not be null!");
        return new WeChatMessageContext(channel, credential, message);
    }
}
